﻿using SvGame.Objects;
using System.Numerics;
using UtilLib;

namespace SvGame.Logic;

public static partial class GameLogic
{
    // 是敌人
    public static bool KillHas(this IRole me, long uid) => me.Comb.KillingList.Contains(uid);
    // 添加敌人
    public static void KillOb(this IRole me, IRole ob)
    {
        if (!me.Room.CanFight())
        {
            return;
        }
        me.Comb.KillingList.TryAdd(ob.Uid);

        ob.Message($"看起来{me.Name}想杀死你！", EMudColor.HIR);

        me.FightOb(ob);
    }
    // 移除敌人
    public static void KillRemove(this IRole me, IRole ob)
    {
        me.Comb.KillingList.Remove(ob.Uid);
        me.FightRemove(ob);
    }
    // 移除所有敌人
    public static void KillRemoveAll(this IRole me)
    {
        foreach (var item in me.Comb.KillingList)
        {
            if (me.Room.GetRole(item, out var role))
            {
                role.KillRemove(me);
            }
        }
        me.Comb.KillingList.Clear();
    }
}
